From 693730095200181960429abe2fe39ad8134aeae7 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Mon, 23 Apr 2007 16:37:03 +0100 Subject: [PATCH] netback: Copy skbuffs that are presented to the start_xmit() function with a multi-page head buffer. The new skbuff will not have a multi-page head buffer, which is a necessary restriction until this is supported by the internals of the netback driver. Signed-off-by: Steven Smith Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index 98072726cb..5873b43c93 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -252,8 +252,11 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) /* * Copy the packet here if it's destined for a flipping interface * but isn't flippable (e.g. extra references to data). + * XXX For now we also copy skbuffs whose head crosses a page + * boundary, because netbk_gop_skb can't handle them. */ - if (!netif->copying_receiver) { + if (!netif->copying_receiver || + ((skb_headlen(skb) + offset_in_page(skb->data)) >= PAGE_SIZE)) { struct sk_buff *nskb = netbk_copy_skb(skb); if ( unlikely(nskb == NULL) ) goto drop; @@ -425,8 +428,9 @@ static void netbk_gop_skb(struct sk_buff *skb, } /* - * This must occur at the end to ensure that we don't trash - * skb_shinfo until we're done. + * This must occur at the end to ensure that we don't trash skb_shinfo + * until we're done. We know that the head doesn't cross a page + * boundary because such packets get copied in netif_be_start_xmit. */ head_meta->id = netbk_gop_frag(netif, head_meta, 0, npo, virt_to_page(skb->data), -- 2.30.2